from typing import Dict
import copy
import urllib.parse
import re
pattern = "text"
a = re.match(pattern, 'text.top')
print(f're match:{a.groups()}')  # ()


a = 32
b = list(a + i for i in range(10))  # [32, 33, 34, 35, 36, 37, 38, 39, 40, 41]
print(f'list:{b}')  # [32, 33, 34, 35, 36, 37, 38, 39, 40, 41]

item = ['hello']
items = [item]*3
print(items)
items[0][0] = "world"
print(items)

x = 10
a = """123"""
b = """123
"""
print(f'a:{len(a)},b:{len(b)}')  # 3,4

print({1, 2, 3, 4, 5}-{5, 6})  # {1, 2, 3, 4}

l = list("abcde")
tup = l[0], l[-1], l[1:3]
print(tup)
print("a={0},b={1},c={2}".format(*tup))

dict = {1: 1, 2: 3}
list = [1, "21"]
print(dict)  # {1: 1, 2: 3}
print(list)  # [1, '21']
a = set([1, "2", 23])
print(a)  # {1, '2', 23}

b = 1
c = 1
a = b*c

l1 = [1, 2, 3]
l2 = l1
l2[0] = 6
print(l1, l2)  # [6,2,3] [6,2,3]


def m(x): return x*3
def n(x, y): return x+y


print(n(m(3), 4))  # 13

n = 0


def f():
    def inner():
        nonlocal n
        n = 2
    n = 1
    print(f"1:{n}")
    inner()
    print(f"2:{n}")


f()
print(n)


def func(n, l):
    n = 2
    l.append(1)


n = 1
l = [1, 2, 3]
func(n, l)
print(n, l)  # 1 [1,2,3,1]

t = "Hello World"
print(t[-5:-1])  # Worl
print(t[-5:0])  # null
print(t[-4:-1])  # orl
print(t[-5:])  # World

v = [1, 2, 3, 4]
y = (x*x for x in v)
print(next(y), next(y))  # 1 4


def rmjs(input):
    p = re.compile("javascript", re.IGNORECASE)
    m = p.match(input)
    print(not m)
    return not m and input or "default"


print(rmjs("ttt:hello"))

print(urllib.parse.quote("I like your web page"))

a = [1, 2]
b = copy.deepcopy(a)
print(f'a:{id(a)},b:{id(b)}')  # a:4461288832,b:4461156160
print(f'a:{id(a[0])},b:{id(b[0])}')  # a: 4458985776, b: 4458985776

print(set("abdkasdk"))  # {'k', 'a', 'd', 's', 'b'}

a = "123abc"
print(a.strip("21"))  # "3abc"
print(a.strip("12"))  # "3abc"

a = "www.google.com."
print(a.split("."))  # ['www', 'google', 'com', '']

print([3, 2, 3] < [2, 3, 4])  # False
print([1, 2, 3] < [2, 3, 4])  # True
print((3, 2, 3) < (2, 3, 4))  # False

a = 1
b = 1
print(id(a))  # 4324976944
print(id(b))  # 4324976944
a = []
b = []
print(id(a))  # 4327127744
print(id(b))  # 4327301568

print(6/2)  # 3.0


def get_list() -> Dict:
    return "12345"


print(get_list())

print({0, 0, 0} and {1, 2, 3})
print(0 or 1)

print(0**0)  # 1
